<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"></script>
</head>

<body>
  <div id="app">
    <label for="male">
      <!-- 在给input的radio设置v-model指令后, 不需要设置相同的name值就可以达到单选的效果 -->
      <input type="radio" id="male" v-model="sex" value="男">男
    </label>
    <label for="female">
      <input type="radio" id="female" v-model="sex" value="女">女
    </label>
    <h2>{{sex}}</h2>
  </div>
  <script>
    const app = new Vue({
      el: "#app",
      data: {
        sex: ""
      }
    })
  </script>
</body>

</html>